package com.atguigu.spring5.jdbctemplate.service;

import com.atguigu.spring5.jdbctemplate.dao.BookDao;
import com.atguigu.spring5.jdbctemplate.entity.Book;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class BookService {
    @Autowired
    private BookDao bookDao;

    public void addBook(Book book) {
        bookDao.add(book);
    }

    public void updateBook(Book book) {
        bookDao.update(book);
    }

    public void deleteBook(String id) {
        bookDao.delete(id);
    }

    public int selectCount() {
        return bookDao.selectCount();
    }

    public Book findBookInfo(String id){
        return bookDao.findBookInfo(id);
    }

    public List<Book> findAllBookInfo(){
        return bookDao.findAllBookInfo();
    }

    public int[] batchAdd(List<Object[]> batchArgs){
        return bookDao.batchAdd(batchArgs);
    };

    public int[] batchUpdate(List<Object[]> batchArgs){
        return bookDao.batchUpdate(batchArgs);
    };

    public int[] batchDelete(List<Object[]> batchArgs){
        return bookDao.batchDelete(batchArgs);
    };

}
